package org.homly.admin.tag.order;

import java.util.HashMap;
import java.util.List;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import org.homly.service.OrderService;
import org.homly.tool.StringTool;

/**
 * 查询订单详细
 */
@SuppressWarnings("serial")
public class OrderDetailListTag extends TagSupport {

	private String name;
	private String orderId;

	@Override
	public int doStartTag() throws JspException {

		List<HashMap<String, String>> orderDetails = null;

		Integer orderIdNum = null;
		if (orderId == null || !StringTool.isNumber(orderId)) {
			orderId = "1";
		}
		orderIdNum = Integer.valueOf(orderId);

		try {
			orderDetails = OrderService.getOrderDetailsByOrderId(orderIdNum);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		pageContext.setAttribute(name, orderDetails);

		return SKIP_BODY;
	}

	public void setName(String name) {
		this.name = name;
	}
	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}
}
